import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { visitorUserVO, visitorUserForm, visitorUserQuery } from '@/api/visitor/visitor-user/types';

/**
 * 查询访客人员列表
 * @param query
 * @returns {*}
 */

export const listvisitorUser = (query?: visitorUserQuery): AxiosPromise<visitorUserVO[]> => {
  return request({
    url: '/visitor/visitor-user/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询访客人员详细
 * @param visitorUserId
 */
export const getvisitorUser = (visitorUserId: string | number): AxiosPromise<visitorUserVO> => {
  return request({
    url: '/visitor/visitor-user/' + visitorUserId,
    method: 'get'
  });
};

/**
 * 新增访客人员
 * @param data
 */
export const addvisitorUser = (data: visitorUserForm) => {
  return request({
    url: '/visitor/visitor-user',
    method: 'post',
    data: data
  });
};

/**
 * 修改访客人员
 * @param data
 */
export const updatevisitorUser = (data: visitorUserForm) => {
  return request({
    url: '/visitor/visitor-user',
    method: 'put',
    data: data
  });
};

/**
 * 删除访客人员
 * @param visitorUserId
 */
export const delvisitorUser = (visitorUserId: string | number | Array<string | number>) => {
  return request({
    url: '/visitor/visitor-user/' + visitorUserId,
    method: 'delete'
  });
};
